type MyReturnType<T> = T extends (...args: any[]) => infer R ? R : never

const fff = (v: boolean) => v ? 1 : 2

type r = MyReturnType<typeof fff>